package com.hytc.mymall.http;

import android.content.Context;

import com.bigkoo.svprogresshud.SVProgressHUD;
import com.hytc.mymall.utils.BaseTools;
import com.hytc.mymall.utils.ToastUtils;
import com.squareup.okhttp.Request;

import java.io.IOException;

public abstract class StringPopCallBack extends StringCallback
{
  private boolean isNetworkAvailable;
  private Context mContext;
  private boolean mIsShow;
    private SVProgressHUD svProgressHUD;

  public StringPopCallBack(Context paramContext, boolean paramBoolean)
  {
    this.mContext = paramContext;
    this.mIsShow = paramBoolean;
    this.isNetworkAvailable = BaseTools.isNetworkAvailable(paramContext);
      svProgressHUD=new SVProgressHUD(paramContext);
  }

  public void dismissDialog()
  {
    if (svProgressHUD.isShowing()) {
        svProgressHUD.dismiss();
    }
  }

  public void onBeforeRequest(Request paramRequest)
  {
    if (this.isNetworkAvailable) {
      showDialog();
    }
  }

  public void onFailure(Request paramRequest, IOException paramIOException)
  {
    showFailureLoadDialog();
  }

  public void onSuccess()
  {
    dismissDialog();
  }

  public void showDialog()
  {
    if (this.mIsShow) {
        svProgressHUD.show();
    }
  }

  public void showFailureLoadDialog()
  {
    if (svProgressHUD.isShowing()) {
        svProgressHUD.dismiss();
    }
    ToastUtils.showToastWithImage(this.mContext, "当前网络不可用!", false);
  }
}



/* Location:           C:\Users\Joker\Desktop\classes_dex2jar.jar

 * Qualified Name:     com.sz.ydgy.http.StringPopCallBack

 * JD-Core Version:    0.7.0.1

 */